/****************************************************************
 * Filename: debugk.h
 * -------------------------------
 * Copyright(C),
 * Author: zhenquan.qiu
 * Version: V1.0.0
 * Last modified: 01/03 2017 11:25
 * Description:
 *
 * Change Log:
 * NO.	Author		    Date		Modified
 * 00	zhenquan.qiu	01/03 2017
 ****************************************************************/
#ifndef _DEBUGK_H_
#define _DEBUGK_H_

#include <linux/fs.h>

#define DEBUG_FMT_DIS   "[%s:%d]"
#define DEBUG_FMT_ARG   __FUNCTION__, __LINE__

enum {
    LOG_WARING   = (1U << 0),
    LOG_DEBUG    = (1U << 1),
    LOG_ERROR    = (1U << 2),
    LOG_LOCATION = (1U << 3),
};

#define pr_wdbg(fmt, ...) \
    do {\
        if (gDebugMask & LOG_WARING) \
            printk(KERN_INFO DEBUG_FMT_DIS fmt, DEBUG_FMT_ARG, ##__VA_ARGS__); \
    } while(0)
#define pr_dbg(fmt, ...) \
    do {\
        if (gDebugMask & LOG_DEBUG) \
            printk(KERN_INFO DEBUG_FMT_DIS fmt, DEBUG_FMT_ARG, ##__VA_ARGS__); \
    } while(0)
#define pr_edbg(fmt, ...) \
    do {\
        if (gDebugMask & LOG_ERROR) \
            printk(KERN_ERR DEBUG_FMT_DIS fmt, DEBUG_FMT_ARG, ##__VA_ARGS__); \
    } while(0)

#define DEBUG_INFO(fmt, arg...) \
    do { \
        printk(KERN_INFO  fmt,  DEBUG_FMT_ARG, ##arg); \
    } while(0)

#define FUNC_ENTER() \
    do {\
        if (gDebugMask & LOG_LOCATION) \
            printk(KERN_INFO "[%s:%d] entering ...\n", DEBUG_FMT_ARG);\
    } while(0)

#endif /* end _DEBUGK_H_ */

